package com.zone.cloud.modules.controller;

import com.yunzone.cloud.common.entity.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {
    @Resource
    private RestTemplate restTemplate;

    private String SERVICE_NAME="http://nacos-provider-payment";

    @GetMapping("/query/{id}")
    public Result<String> query(@PathVariable int id){
        log.info("开始干活");
        Result<String> result=restTemplate.getForObject(SERVICE_NAME+"/payment/query/"+id,Result.class);
        return result;
    }
}
